package org.lop.demo.service;

import java.util.Collection;
import java.util.List;

import org.lop.demo.domain.Bank;
import org.lop.demo.repository.BankRepository;
import org.lop.modules.data.mapper.QueryFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 银行业务.
 * 
 * @author 潘瑞峥
 * @date 2013-6-2
 */
@Service
public class BankService {

	@Autowired
	private BankRepository bankRepository;

	/**
	 * id查询.
	 */
	public Bank get( String id ) {
		return this.bankRepository.get( id );
	}

	/**
	 * 分页查询.
	 */
	public Page<Bank> findPage( Pageable pageable, List<QueryFilter> filters ) {
		return this.bankRepository.findPage( pageable, filters );
	}

	/**
	 * 保存.
	 */
	@Transactional
	public void save( Bank entity ) {
		this.bankRepository.save( entity );
	}

	/**
	 * 保存.
	 */
	@Transactional
	public void save( Collection<Bank> entities ) {
		this.bankRepository.save( entities );
	}

}